package com.ssm.sample.service.services;

import java.util.List;

import org.springframework.stereotype.Service;

import com.ssm.sample.entity.Page;
import com.ssm.sample.service.base.BaseService;
import com.ssm.sample.util.PageData;


/**
 * 222222
 * 
 * 
 * @author 卖糖果的坏小孩
 *
 */
@Service("YXQServices")
public class YXQServices extends BaseService
{
	/**
	 * 查询全部信息
	 * @param pd
	 * @return
	 */
	  public List<PageData> selectAll(PageData pd)
	  {
	    List<PageData> list = this.sqlSessionTemplate.<PageData>selectList("mappers.YXQMappers.selectAll",pd);
	    return list; 
	  }
	  
	  /**
	   * 查询一个信息
	   * @param pd
	   * @return
	   */
	  public PageData selectOneById(String selectID) {
			return this.sqlSessionTemplate.<PageData> selectOne("mappers.YXQMappers.selectOneById", selectID);
		}
	  
	  public PageData selectOneByName(String selectName) {
			return this.sqlSessionTemplate.<PageData> selectOne("mappers.YXQMappers.selectOneByName", selectName);
		}
	  
		/**
		 * 删除单个雇员
		 * 
		 * @param id
		 * @return
		 */
		public boolean deleteMemberById(String memberId) {
			int result = this.sqlSessionTemplate.delete("mappers.YXQMappers.deleteMemberById", memberId);
			System.out.println("执行到Service");
			return result > 0;
		}
		
		
		
	  /**
	   * 插入一条信息
	   * @param pd
	   * @return
	   */
		public boolean insertOneById(PageData pd) {
			int count = this.sqlSessionTemplate.insert("mappers.YXQMappers.insertOneById", pd);
			return count > 0;
		}	 
	  
	
		/**
		 * 更新单个雇员的基本信息
		 * 
		 * @param pd
		 * @return
		 */
		public boolean updateOneById(PageData pd) {
			int count = this.sqlSessionTemplate.update("mappers.YXQMappers.updateOneById", pd);
			return count > 0;
		}

	

}